package com.java.program_questions;

/**
 * 问题：求100之内的素数
 * 分析：
 */
public class Question27 {
    public static void main(String[] args) {
        int b = 1;
        int count = 0;
        System.out.println("100内素数有");
        for (int i = 1; i <= 100; i++) {
            for (int j = 2; j < i; j++) {
                if (i % j == 0) {
                    b = 0;
                    break;
                }
            }
            if (b == 1) {
                count++;
                if (count == 5) {
                    System.out.println(i);
                    count = 0;
                } else {
                    System.out.print(i + "\t");
                }
            }
            b = 1;
        }
    }
}
